def my_write_table():
    lst = [
        ["name", "price", "num"],
        ['phone', "4000", "2"],
        ['cup', "10", "20"]
    ]
    with open('table.txt', 'w', encoding='utf-8') as f:
        for item in lst:
            line=",".join(item)
            f.write(line)
            f.write('\n')

def my_read_table():
    data=[]
    with open('table.txt', 'r', encoding='utf-8') as f:
        lst=f.readlines()
        for item in lst:
            data.append(item.strip().split(','))
    print(data)

if __name__ == '__main__':
    my_write_table()
    my_read_table()